<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@include file="/WEB-INF/jsp/common/navigationRight.jsp"%>
<%@include file="/WEB-INF/jsp/common/head.jsp"%>
<%@include file="/WEB-INF/jsp/common/navigationLeft.jsp"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<div style="width:100%; height:100%; position:fixed; z-index:100; top:0; display:none; left:0;" id="allP" >
    <div style="width:100%; height:100%; position:absolute; top:0; left:0; background:#000; opacity:0.5;"></div>
    <div style="width:404px; height:154px; background:#fff; position:absolute; top:50%; left:50%; margin-left:-252px; margin-top:-100px; border:2px solid #666;">
        <p style="color: #666666;font-size: 16px;absolute;line-height:170px;text-align: center; font-family: Microsoft YaHei;;">该项目已还清，为保护企业隐私，不再公示项目信息</p>
        <div style="width: 30px;height: 30px;position: absolute;top: 11px;right: 0px;color: #666;font-size: 20px;cursor: pointer;" id="close">X</div>
    </div>

</div>
<div class="m2-userCentermanage-con">
    <div class="m2-manage-search">
        <div class="m2-manage-search-head">
            <h3><i></i>投资记录</h3>
        </div>
        <div class="m2-manage-search-selector">
            <ul class="m2-manageSearchsel-time m2-manageSearchsel-time1" style="margin-bottom:15px">
                <li>时间范围：</li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link1"><span class="m2-manSealink-sel" style="background:none;color: grey" onclick="displayAllTime(10000)" data-days='10000'>全部</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link1"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllTime(7)" data-days='7' >最近7天</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link1"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllTime(30)" data-days='30'>一个月</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link1"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllTime(90)" data-days='90'>三个月</span></li>
                <li>从<input id="m2-manSeadate-start" type="text"></li>
                <li>到<input id="m2-manSeadate-end" onblur="searchDATE()" type="text"></li>
            </ul>
            <ul class="m2-manageSearchsel-time m2-manageSearchsel-time2" style="margin-bottom:15px">
                <li>回款状态：</li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link2"><span class="m2-manSealink-sel" style="background:none;color: grey" onclick="displayAllType(0)" status='0'>全部</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link2"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllType(1)" status="1">投标中</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link2"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllType(3)" status="3">还款中</span></li>
                <li class="m2-manageSearchsel-link m2-manageSearchsel-link2"><span class="m2-manSealink-unsel" style="background:none;color: grey" onclick="displayAllType(4)" status="4">已结清</span></li>
            </ul>

            <table class="m2-userInvest-table"  cellpadding="0" cellspacing="0" >
                <tr class="m2-userInevst-head" >
                    <th style="width:250px;">项目名称</th>
                    <th style="width:120px;">投资金额</th>
                    <th style="width:60px;">收益率</th>
                    <th style="width:180px;">投资日期</th>
                    <th style="width:120px;">投资状态</th>
                    <th style="width:108px;"></th>
                </tr>

                <c:forEach items="${InvestmentList}" var="investments" varStatus="row">
                    <tr class="m2-userTable-noData">
                        <th style="width:250px;font-size: 18px">${investments.proName}</th>
                        <th style="width:120px;font-size: 18px">${investments.investAmount}</th>
                        <th style="width:60px;font-size: 18px">${investments.rate}</th>
                        <th style="width:180px;font-size: 18px"><fmt:formatDate pattern="yyyy-MM-dd" value="${investments.investDate}"/></th>
                        <th style="width:120px;font-size: 18px">
                               <c:if test="${investments.staus == 1}">
                                投标中
                               </c:if>
                            <c:if test="${investments.staus == 2}">
                                审核中
                            </c:if>
                            <c:if test="${investments.staus == 3}">
                                还款中
                            </c:if>
                            <c:if test="${investments.staus == 4}">
                                已结清
                            </c:if>
                        </th>
                        <th style="width:108px;font-size: 18px"></th>
                    </tr>
                </c:forEach>


            </table>
            <input type="hidden" value=1 class="nowpages">
            <input type="hidden" value= class="recordpages">

        </div>
    </div>
</div>

        <div style="margin-left: 500px ; margin-top: 50px;font-size: 20px">
            <input type="hidden" value="${ph.currentPageNo }" id="currentPage" />
            <input type="hidden" value="${ph.totalPageCount}" id="totalPages" />
            当前页数:[<span id="spcp">${ph.currentPageNo}</span>/<span id="sptp">${ph.totalPageCount}</span>]&nbsp;
            <a href="" class="previous" id="first" style="color:gray">首页</a>
            <a href="javascript:void(0)" class="previous" id="previous" style="color:gray">上一页</a>
            <a href="javascript:void(0)" class="next" id="next" style="color:blue">下一页</a>
            <a href="javascript:void(0)" class="next" id="last" style="color:blue">末页</a>
            跳转到：<input type="text" value="" id="jumpPageNo" size="10"/><button style="width: 50px" id="jumpGo">GO</button>
        </div>
</div>

         <input type="hidden" id="userID" value="${userSession.userId}">

<script>

    var oP=document.getElementById('allP');
    var oClose=document.getElementById('close');
    //oP.style.display='none';
    oClose.onclick=function(){
        oP.style.display='none';
    };
    var investdata=new Array(0,0,0);
    var capitalprogress=new Array();

    /**
     * 已结束的项目不允许查看合同
     */
    function linkContractContract(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("member-contract-investor.shtml?id="+bid,"_blank");
        }
    }
    /**
     * 已结束的项目不允许查看合同
     */
    function linkContracttransContract(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("member-contracttrans-investor.shtml?id="+bid,"_blank");
        }
    }
    /**
     * 已结束的项目不允许下载合同
     */
    function linkDownload(that){
        var bid=that.getAttribute('bid');
        var status = that.getAttribute('status');
        if(status==7||status==11){
            oP.style.display='block';
        } else {
            window.open("Member-Contract-createAndSendPdfbyid?id="+bid,"_blank");
        }
    }


    /*
    * 根据时间查询
    *
    * */
    function displayAllTime(queryTime) {
        var status = $(".m2-manageSearchsel-time2 .m2-manSealink-sel").attr("status")
        var id = $("#userID").val();
        var currentPageNo =1;
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPageNo;
    }

    /*
   * 根据状态查询查询
   *
   * */
    function displayAllType(status) {
        var queryTime = $(".m2-manageSearchsel-time1 .m2-manSealink-sel").attr("data-days");
        var id = $("#userID").val();;
        var currentPageNo =1;
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPageNo;
    }

    /*
    *
    * 首页
    * */
    $("#first").click(function () {
        var id = $("#userID").val();
        var queryTime = $(".m2-manageSearchsel-time1 .m2-manSealink-sel").attr("data-days");
        var status = $(".m2-manageSearchsel-time2 .m2-manSealink-sel").attr("status")
        var currentPageNo =1;
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPageNo;
    })


    /*
    * 尾页
    * */
    $("#last").click(function () {
        var id = $("#userID").val();
        var queryTime = $(".m2-manageSearchsel-time1 .m2-manSealink-sel").attr("data-days");
        var status = $(".m2-manageSearchsel-time2 .m2-manSealink-sel").attr("status")
        var currentPageNo =$("#totalPages").val();
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPageNo;
    })


    //上一页
    $("#previous").click(previous);
    function previous(){
        var id = $("#userID").val();
        var queryTime = $(".m2-manageSearchsel-time1 .m2-manSealink-sel").attr("data-days");
        var status = $(".m2-manageSearchsel-time2 .m2-manSealink-sel").attr("status")
        var currentPage = parseInt($("#currentPage").val()) - 1;
        if(currentPage < 1){
            currentPage = 1 ;
        }
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPage;
    }

    //下一页
    $("#next").click(next);
    function next(){
        var id = $("#userID").val();
        var queryTime = $(".m2-manageSearchsel-time1 .m2-manSealink-sel").attr("data-days");
        var status = $(".m2-manageSearchsel-time2 .m2-manSealink-sel").attr("status")
        var currentPageStr = $("#currentPage").val();
        var currentPage = parseInt(currentPageStr) + 1 ;
        var totalPages = parseInt($("#totalPages").val());
        if(currentPage - totalPages > 0){
            currentPage = totalPages;
        }
        window.location.href="/lzy/investment?id="+id+"&querytime="+queryTime+"&staus="+status+"&currentPageNo="+currentPage;
    }


    /**
     * 一段时间的投资
     */
    function searchDATE() {
        var id = $("#userID").val();
        var begin = $("#m2-manSeadate-start").val();
        var end = $("#m2-manSeadate-end").val();
        var currentPageNo =1;

        window.location.href="/lzy/investment?id="+id+"&begin="+begin+"&end="+end+"&currentPageNo="+currentPageNo;
    }
</script>





<script type="text/javascript" src="${pageContext.request.contextPath }/statics/statics/usercenter/js/m2-userCenter-invest.js"></script>

</body>
</html>